package com.ruoyi.job.task;
import com.ruoyi.heima.news.client.NewsClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;

@Slf4j
@Component("newsCleanTask")
public class NewsCleanTask {

    @Autowired
    private NewsClient newsClient;
    public void deletedOneWeekAgoNewsTask() {
        log.info("自动删除一周前更新的新闻，任务开始执行...：{}", LocalDateTime.now());
        // 调用服务层方法，逻辑删除或物理删除符合条件的新闻
        newsClient.deletedOneWeekAgoNews();
        log.info("自动删除一周前更新的新闻，定时任务结束执行...：{}", LocalDateTime.now());
    }
}
